package com.fjnu.javaweb;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@org.aspectj.lang.annotation.Aspect
public class Aspect {

    @Before("@annotation(com.fjnu.javaweb.Loggable)")
    public void logBeforeMethodExcution(JoinPoint jp){
        log.info("[log before method execution] method : {} | args:{}",jp.getSignature().getName(),jp.getArgs());
    }

    @Before(value = "execution(* com.fjnu.javaweb.service.ProductService.add(..))")
    public void checkInventory(){
        log.info("check Inventory before add Product");
    }

}
